From 469e7be33da63921c1f98776a6a97888ec6696a0 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 9 Nov 2008 12:59:17 -0800 Subject: [PATCH] Set mail-interactive if /usr/bin/mail is not executable and fakemail is chosen. --- debian/changelog | 8 +++- debian/patches/avoid-fakemail-mail-loss.diff | 42 ++++++++++++-------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index 95c0113b69f..0ab32ac428c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,13 @@ emacs22 (22.2+2-5) unstable; urgency=low across all the relevant platforms. Thanks to Sven Joachim for the fix. (closes: #503054) - -- Rob Browning Sun, 09 Nov 2008 10:40:43 -0800 + * Set mail-interactive to t if /usr/bin/mail is not an executable and + fakemail is chosen. This should still help avoid silent mail loss, + but won't signal an error if the mailer is never invoked. Thanks to + Ralf Resack for proposing the + fix. (closes: #429059) + + -- Rob Browning Sun, 09 Nov 2008 12:05:33 -0800 emacs22 (22.2+2-4) unstable; urgency=medium diff --git a/debian/patches/avoid-fakemail-mail-loss.diff b/debian/patches/avoid-fakemail-mail-loss.diff index d8f2e997154..b3f98575379 100644 --- a/debian/patches/avoid-fakemail-mail-loss.diff +++ b/debian/patches/avoid-fakemail-mail-loss.diff @@ -12,15 +12,18 @@ For now, Debian sets fakemail's MAIL_PROGRAM_NAME to /usr/bin/mail (which is the correct value for Debian systems) rather than - /bin/mail. Debian also adjusts Emacs to test for the existence of - /usr/bin/mail before trying to run fakemail. This is not an ideal - solution, but it should be an improvement. + /bin/mail. Debian also adjusts Emacs to test whether or not + /usr/bin/mail exists and is executable. If either of these tests + fail, then mail-interactive is set to t. That should ensure that a + user will actually see an error if they attempt to use the broken + fakemail. - Note that Debian forces the value to /usr/bin/mail. The build will - fail if any other value is specified. This is done to ensure that - MAIL_PROGRAM_NAME isn't accidentally set to some other value during - the build process. If this is undesirable for some reason, just - commment out avoid-fakemail-loss.diff in debian/patches/series. + Note that Debian actually forces the MAIL_PROGRAM_NAME value to + /usr/bin/mail. The build will fail if any other value is specified. + This is done to ensure that MAIL_PROGRAM_NAME isn't accidentally set + to some other value during the build process. If this is + undesirable for some reason, just comment out + avoid-fakemail-loss.diff in debian/patches/series. Index: sid/lib-src/fakemail.c =================================================================== @@ -43,14 +46,16 @@ Index: sid/lisp/mail/feedmail.el =================================================================== --- sid.orig/lisp/mail/feedmail.el +++ sid/lisp/mail/feedmail.el -@@ -1348,7 +1348,10 @@ +@@ -1348,7 +1348,12 @@ "/usr/lib/sendmail") ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail") - (t "fakemail")) + (t + (if (not (file-executable-p "/usr/bin/mail")) -+ (error "/usr/bin/mail is not executable")) ++ (progn ++ (message "/usr/bin/mail is not an executable. Setting mail-interactive to t.") ++ (setq mail-interactive t))) + "fakemail")) nil errors-to nil "-oi" "-t") ;; provide envelope "from" to sendmail; results will vary @@ -59,14 +64,16 @@ Index: sid/lisp/mail/sendmail.el =================================================================== --- sid.orig/lisp/mail/sendmail.el +++ sid/lisp/mail/sendmail.el -@@ -53,7 +53,10 @@ +@@ -53,7 +53,12 @@ ((file-exists-p "/usr/sbin/sendmail") "/usr/sbin/sendmail") ((file-exists-p "/usr/lib/sendmail") "/usr/lib/sendmail") ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail") - (t "fakemail")) ;In ../etc, to interface to /bin/mail. + (t + (if (not (file-executable-p "/usr/bin/mail")) -+ (error "/usr/bin/mail is not executable")) ++ (progn ++ (message "/usr/bin/mail is not an executable. Setting mail-interactive to t.") ++ (setq mail-interactive t))) + "fakemail")) ;In ../etc, to interface to /bin/mail. "Program used to send messages." :group 'mail @@ -75,16 +82,17 @@ Index: sid/lisp/gnus/message.el =================================================================== --- sid.orig/lisp/gnus/message.el +++ sid/lisp/gnus/message.el -@@ -4026,7 +4026,12 @@ +@@ -4026,7 +4026,13 @@ "/usr/lib/sendmail") ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail") - (t "fakemail")) + (t -+ (if (not -+ (file-executable-p "/usr/bin/mail")) -+ (error -+ "/usr/bin/mail is not executable")) ++ (if (not (file-executable-p ++ "/usr/bin/mail")) ++ (progn ++ (message "/usr/bin/mail is not an executable. Setting mail-interactive to t.") ++ (setq mail-interactive t))) + "fakemail")) nil errbuf nil "-oi") ;; Always specify who from, -- 2.30.2